<template>
  <a-card :bordered="false">

    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <!--查询条件设置-->
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="模板名称">
              <a-input placeholder="请输入name"
                       v-model="queryParam.name"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="状态">
              <j-dict-select-tag
                v-model="queryParam.status"
                dictCode="common_status"
                placeholder="请选择status"></j-dict-select-tag>
            </a-form-item>
          </a-col>

        </a-row>
      </a-form>
    </div>

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button class="ant-btn-custom" @click="searchQuery" icon="search">查询</a-button>
      <a-button class="ant-btn-custom" @click="searchReset" icon="reload">重置</a-button>
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
    </div>

    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">
                        <span slot="action" slot-scope="text, record">

                          <a @click="handleEdit(record)">编辑</a>
                          <a-divider type="vertical"/>
                          <a-dropdown>
                            <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
                            <a-menu slot="overlay">
                              <a-menu-item>
                                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                                  <a>删除</a>
                                </a-popconfirm>
                              </a-menu-item>
                            </a-menu>
                          </a-dropdown>
                        </span>
      </a-table>
    </div>
    <!-- table区域-end -->

    <!-- 表单区域 -->
    <MoudualTemplateConfigModal ref="modalForm" @ok="modalFormOk"></MoudualTemplateConfigModal>
  </a-card>
</template>

<script>
  import MoudualTemplateConfigModal from './modules/MoudualTemplateConfigModal'
  import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  import {getAction} from "../../api/manage";

  export default {
    name: "MoudualTemplateConfigList",
    mixins: [JeecgListMixin],
    components: {
      MoudualTemplateConfigModal
    },
    data() {
      return {
        description: '模板内容配置表管理页面',
        editor: {},
        systemTypeList: [],
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: "center",
            customRender: function (t, r, index) {
              return parseInt(index) + 1;
            }
          },
          {
            align: 'center',
            sorter: true,
            title: '模板名称',
            dataIndex: 'name',
          },
          {
            align: 'center',
            sorter: true,
            title: '输出相对目录',
            dataIndex: 'outPutPath'
          },
          {
            dataIndex: 'fileType_dictText',
            align: 'center',
            sorter: false,
            title: '文件类型',
          },
          {
            align: 'center',
            sorter: true,
            title: '状态',
            dataIndex: 'status_dictText',
          },
          {
            title: '操作',
            dataIndex: 'action',
            align: "center",
            scopedSlots: {customRender: 'action'},
          }
        ],
        url: {
          list: "/generator/MoudualTemplateConfig/list",
          delete: "/generator/MoudualTemplateConfig/delete",
          excelConfig: "generator/MoudualTemplateConfig/excelConfig",
          allList: "generator/MoudualPathConfig/allList"
        },
      }
    },
    created() {
      this.isorter = {
        column: 'name',
        order: 'desc',
      }
    },
    computed: {},
    methods: {
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>
